import re

if __name__ == '__main__':
    pattern = 'this'
    text = 'Does this text match the pattern?'
    text = 'this text match the pattern?'

    # re.match 函数从字符串开始进行匹配
    match = re.match(pattern=pattern, string=text)

    if match is not None:
        print(match)
        # 匹配正则表达式在字符串的起始位置
        print(match.start())
        # 匹配正则表达式在字符串的结束位置
        print(match.end())
        # 匹配正则表达式在字符串的位置（起始和结束）
        print(match.span())

        # search 返回对象不使用
        # print(match.groups(0))
        # print(match.groupdict())

    else:
        print("没有匹配结果")
